//
//  UserCenter.Once.swift
//  Center
//
//  Created by Flutter on 2021/8/10.
//

import Foundation
import Standard
import Center_Storage

public extension UserCenter {
    
//    static var once: OnceStorage {
//        get {
//            guard let once: OnceStorage = try? store.sync.get() else {
//                return OnceStorage()
//            }
//            return once
//        }
//        set {
//            try? store.sync.put(storableObject: newValue)
//        }
//    }
    
    static var once: OnceStorage = {
        guard let once: OnceStorage = try? store.sync.get() else {
            return OnceStorage()
        }
        return once
    }() {
        didSet {
            try? store.sync.put(storableObject: once)
        }
    }
    
}
